[1,2 ],[2,2,2,2]
[2]
两个数组的公共元素只有2
[1,2,3],[8,2,2,3,8]
[2,3]
两个数组的公共元素为2和3,返回[3,2]也是一个正确的答案
class Solution: def intersection(self , nums1: List[int], nums2: List[int]) -> List[int]: # write code here return list(set(nums1) & set(nums2))
class Solution: def intersection(self , nums1: List[int], nums2: List[int]) -> List[int]: # write code here return list(set(nums1)&set(nums2))
这道题你会答吗?花几分钟告诉大家答案吧!
扫描二维码,关注牛客网
下载牛客APP,随时随地刷题